﻿var sAdmineditCell = 'adminedit';
var sNavCell = 'panelNavigation';
var sSplitterCell = 'resizeSplitter';
var sContentCell = 'panelContent';

var px = 'px';
var sSplitterDefault = '250px';
var sTmpNavCellWidth = '250px';
var sMenuHeight = "30px";

var winWidth=0;
var oContentCell= null;
var oNavCell= null;
var oSplitterCell= null;


function InitVars()
{        
 
    winWidth = parseInt(document.body.clientWidth);
    
    // Content
    oContentCell = document.getElementById(sContentCell);
    
    //Navigator
    oNavCell = document.getElementById(sNavCell);
    
    //Splitter
    oSplitterCell = document.getElementById(sSplitterCell);
   
   //keypress T
    document.onkeypress = KeyPressOpenCloseToc;
    return ;
 }
 

 
 function FixedOpenColsePanel()
{    
    InitVars();        
    oSplitterCell.style.width="5px";
    if (oNavCell.style.width != "0px")
    {        
     
        oNavCell.style.width = "0px";        
        oContentCell.style.left = "5px";
        oSplitterCell.style.left = "0px";        
    }
    else 
    {
        
        oNavCell.style.width = sSplitterDefault ;
        oSplitterCell.style.left = sSplitterDefault ;             
        oContentCell.style.left = parseInt(oNavCell.style.width) + parseInt(oSplitterCell.style.width) + px;         
    }    
    ResizeContentArea();
    return;
}


 
 // CHange the color and image of the splitter bar
function HighlightSplitterBar(strObjName, intOnOff)
{       
    var sliderBar = document.getElementById(strObjName);
	
    if (intOnOff == 0)
    {
        sliderBar.style.backgroundImage ='url(img/lib_grippy1.gif)';
    }
    else
    {
        sliderBar.style.backgroundImage ='url(img/lib_grippy.gif)';
    }
   return;
}

  function ResizeContentArea()
 {  
    InitVars();        
    if(oNavCell.style.width != "")
    {    
        oContentCell.style.width = winWidth-6- parseInt(oContentCell.style.left)  + px;  
    }
    else 
    {      
            oContentCell.style.width = winWidth-6- parseInt(sSplitterDefault)  + px;             
    }
    return;
 }

//
function KeyPressOpenCloseToc(e)
{
   if(window.event.keyCode == 116)
	{   
		if (window.event.srcElement.tagName.toLowerCase() != "textarea" && window.event.srcElement.tagName.toLowerCase() != "input")
		{
		    FixedOpenColsePanel();
		}
		window.event.cancelBubble = true;
	}
	return;
}
